<template>
  <view class="invite">
    <Navbar :title="t('share.title')"> </Navbar>
    <view class="top">
      <view class="top1">
        <view>{{ t('share.number') }}</view>
        <text>{{ inviteDetail[0]?.recommend_total }}</text>
      </view>
      <view class="top1">
        <view>{{ t('share.team') }}</view>
        <text>{{ inviteDetail[0]?.team_total }}</text>
      </view>
    </view>
    <view class="btn" @click="invite">{{ t('share.friends') }}</view>
    <view class="text">{{ t('share.details') }}</view>
    <!-- 渲染 -->
    <scroll-view scroll-y class="abc" v-if="inviteDetail[0]?.child_data > 0">
      <view
        class="bottom"
        v-for="(item, index) in inviteDetail[0]?.child_data"
        :key="index"
      >
        <view class="t1">{{ t('share.address') }}</view>
        <view class="t2" style="margin-top: 18rpx">{{ item.user_id }}</view>
        <view class="t3">{{ t('share.of') }}</view>
        <view class="t4">
          <image class="img" src="/static/share/Frame.png" mode="scaleToFill" />
          <text>{{ item.total }}</text>
        </view>
      </view>
    </scroll-view>
    <nodata v-else></nodata>
  </view>
</template>

<script setup>
import nodata from '../../components/nodata.vue';
import Navbar from '../../components/Navbar.vue';
import { ref } from 'vue';
const navbarTitle = ref('');
import api from '../../networks/apis';
import { onLoad } from '@dcloudio/uni-app';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
//邀请明细
const inviteDetail = ref([]);
const getInviteDetail = async () => {
  const { data } = await api.getInviteDetailAPI();
  inviteDetail.value = data;
  console.log('----->data', data);
};
getInviteDetail();

//跳转
const invite = () => {
  uni.navigateTo({ url: '/pages/invite/index' });
};
</script>

<style lang="scss" scoped>
.abc {
  background-color: #082435;
}
.invite {
  width: 750rpx;
  height: 100vh;
  background: linear-gradient(180deg, #040a40 0%, #042e40 0%, #0d1324 100%);
  .top {
    width: 688rpx;
    height: 254rpx;
    background-image: url('/static/invite/Rectangle 47.png');
    background-size: cover;
    background-repeat: no-repeat;
    margin: 18rpx auto;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-top: 20rpx;
    .top1 {
      view {
        height: 28rpx;
        font-size: 24rpx;
        font-family: Arial, Arial;
        font-weight: normal;
        color: rgba(255, 255, 255, 0.5);
        line-height: 28rpx;
      }
      text {
        display: block;
        height: 46rpx;
        font-size: 32rpx;
        font-family: Arial, Arial;
        font-weight: 900;
        color: #ffffff;
        line-height: 38rpx;
        margin-top: 20rpx;
      }
    }
  }
  .btn {
    width: 526rpx;
    height: 112rpx;
    background-image: url('/static/share/Rectangle 62.png');
    background-size: cover;
    background-repeat: no-repeat;

    font-size: 32rpx;
    font-family: Arial, Arial;
    font-weight: bold;
    color: #ffffff;
    line-height: 38rpx;
    text-align: center;
    line-height: 112rpx;
    margin: 40rpx auto 0;
  }
  .text {
    display: block;
    height: 46rpx;
    font-size: 32rpx;
    font-family: Arial, Arial;
    font-weight: 900;
    color: #ffffff;
    line-height: 46rpx;
    text-align: center;
    margin-top: 62rpx;
    margin-bottom: 32rpx;
  }
  .bottom {
    width: 690rpx;
    height: 208rpx;
    background-image: url('/static/share/Rectangle 33.png');
    background-size: cover;
    background-repeat: no-repeat;
    padding-left: 20rpx;
    margin: 0 auto 20rpx;
    .t1 {
      height: 34rpx;
      font-size: 24rpx;
      font-family: Arial, Arial;
      font-weight: 900;
      color: rgba(255, 255, 255, 0.5);
      line-height: 28rpx;
      padding-top: 20rpx;
    }
    .t2 {
      height: 28rpx;
      font-size: 24rpx;
      font-family: Arial, Arial;
      font-weight: normal;
      color: rgba(255, 255, 255, 0.5);
      line-height: 28rpx;
    }
    .t3 {
      height: 34rpx;
      font-size: 24rpx;
      font-family: Arial, Arial;
      font-weight: 900;
      color: rgba(255, 255, 255, 0.5);
      line-height: 28rpx;
      margin: 30rpx 0 10rpx;
    }
    .t4 {
      display: flex;
      .img {
        width: 40rpx;
        height: 40rpx;
      }
      text {
        height: 46rpx;
        font-size: 32rpx;
        font-family: Arial, Arial;
        font-weight: 900;
        color: #ffffff;
        line-height: 38rpx;
        margin-left: 10rpx;
      }
    }
  }
}
</style>
